package dietmar.ckm;

import java.awt.BorderLayout;
import java.awt.EventQueue;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.JTextPane;
import java.awt.Font;
import javax.swing.JLabel;
import javax.swing.border.TitledBorder;
import javax.swing.border.LineBorder;
import java.awt.Color;
import javax.swing.JTable;
import javax.swing.JButton;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import javax.swing.table.DefaultTableModel;
import javax.swing.AbstractListModel;
import javax.swing.DefaultListModel;
import javax.swing.JSplitPane;
import javax.swing.JLayeredPane;
import javax.swing.JInternalFrame;
import javax.swing.JList;

public class LigaGui extends JFrame {

	private JPanel contentPane;
	static Liga liga=new Liga();
	
	DodajKlubGui dodajKlub= new DodajKlubGui();


	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					LigaGui frame = new LigaGui();
					frame.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}

	/**
	 * Create the frame.
	 */
	public LigaGui() {
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setBounds(100, 100, 488, 348);
		contentPane = new JPanel();
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		setContentPane(contentPane);
		contentPane.setLayout(null);
		
		JLabel lblCKlasa = new JLabel("C Klasa");
		lblCKlasa.setFont(new Font("Tahoma", Font.PLAIN, 20));
		lblCKlasa.setBounds(10, 11, 81, 25);
		contentPane.add(lblCKlasa);
		
		JPanel panel = new JPanel();
		panel.setBorder(new TitledBorder(new LineBorder(new Color(0, 0, 255)), "Tabela", TitledBorder.LEADING, TitledBorder.TOP, null, null));
		panel.setBounds(10, 43, 268, 260);
		contentPane.add(panel);
		panel.setLayout(null);
		
		JList list1 = new JList();
		list1.setBounds(10, 21, 248, 228);
		panel.add(list1);
		list1.setModel(new javax.swing.AbstractListModel() {
	            String[] strings = {liga.zwrocKlub(0), liga.zwrocKlub(1), liga.zwrocKlub(2), liga.zwrocKlub(3), "Item 5" };
	            public int getSize() { return strings.length; }
	            public Object getElementAt(int i) { return strings[i]; }
	        });
	        javax.swing.DefaultListModel model = new javax.swing.DefaultListModel();
	        list1 = new javax.swing.JList(model);
	
		
		JButton btnDodajKlub = new JButton("Dodaj Klub");
		btnDodajKlub.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
			
				dodajKlub.setVisible(true);
				
			}
		});
		btnDodajKlub.setBounds(320, 280, 124, 23);
		contentPane.add(btnDodajKlub);
		
		   
   	   
	}
}
